#include<bits/stdc++.h>

using namespace std;
using ll = long long;
#define endl '\n'

template<typename T=int>
inline T read() {
    T x;
    cin >> x;
    return x;
}

int a[10000 + 1], n;


int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    n = 10;
    for (int i = 0; i < 10; i++)cin >> a[i];
    int p = upper_bound(a, a + n - 1, a[n - 1]) - a;//logn时间找到最右边的待插入的位置
    //这个比一直swap效率高3倍
    int t = a[n - 1];
    for (int i = n - 1; i - 1 >= p; i--) {
        a[i] = a[i - 1];
    }
    a[p] = t;


    copy(a, a + n, ostream_iterator<int>(cout, "\n"));
    cout << endl;


    return 0;
}
